<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
                <title></title>
                <link rel="stylesheet" href="http://localhost/shopFrame/Application/ADMIN/View/Public/Css/bootstrap.min.css" />
                <link rel="stylesheet" href="http://localhost/shopFrame/Application/ADMIN/View/Public/Css/common.css" />
                <script type='text/javascript' src='http://localhost/shopFrame/hdphp/Extend/Org/Jquery/jquery-1.8.2.min.js'></script>

                <script type="text/javascript" src='__UPLOADIFY__/jquery.uploadify.js'></script>
                </style> 
        </head>
        <body>
                <div class="container-fluid">
                        <div class="row-fluid">
                                <div class="span12">

                                        <form action="" method='post' >
                                                <fieldset>
                                                        <legend>编辑商品品牌</legend>
                                                        <table class="table table-bordered table-hover">
                                                                <tr class="info">
                                                                        <td>品牌名称</td>
                                                                        <td colspan="2">
                                                                                <input type="text" name='bname' value='<?php echo $data['bname'];?>'/>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>品牌所属类型</td>
                                                                        <td colspan="2">
                                                                                <select name='type_tid'>
                                                                                        <option value="0">-----------请选择-----------</option>
                                                                                        <?php if(is_array($Type)){?><?php  foreach($Type as $key=>$v){ ?>
                                                                                                <option value="<?php echo $v['tid'];?>" <?php if($v['tid'] == $data['type_tid']){?>selected="selected"<?php }?>><?php echo $v['tname'];?></option>
                                                                                        <?php }}?>
                                                                                        
                                                                                </select>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>品牌LOGO</td>
                                                                        <td>
                                                                                <link rel="stylesheet" type="text/css" href="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/uploadify.css" />
            <script type="text/javascript" src="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/jquery.uploadify.min.js"></script>
            <script type="text/javascript">
            var HDPHP_CONTROL         = "http://localhost/shopFrame/index.php?m=ADMIN&c=Brand&bid=17&a=hd_uploadify";
            var UPLOADIFY_URL    = "http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/";
            var HDPHP_UPLOAD_THUMB    ="";
HDPHP_UPLOAD_TOTAL = 0</script>
            <script type="text/javascript" src="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/hd_uploadify.js"></script>
<script type="text/javascript">
    $(function() {
        hd_uploadify_options.removeTimeout  =0;//提示框消息时间
        hd_uploadify_options.fileSizeLimit  ="1MB";
        hd_uploadify_options.fileTypeExts   ="*.gif;*.jpg;*.png;*.jpeg";
        hd_uploadify_options.showalt        =0;
        hd_uploadify_options.uploadLimit    =1;
        hd_uploadify_options.input_type    ="input";
        hd_uploadify_options.elem_id    ="";
        hd_uploadify_options.success_msg    ="正在上传...";//上传成功提示文字
        hd_uploadify_options.formData ={type:"*.gif;*.jpg;*.png;*.jpeg",water : "1",fileSizeLimit:1048576, someOtherKey:1,PHPSESSID:"7bbp2c3dd9p61uobiea0srjih7",upload_dir:"upload/logo/",hdphp_upload_thumb:""};
        hd_uploadify_options.thumb_width =98;
        hd_uploadify_options.thumb_height          =35;
        hd_uploadify_options.uploadsSuccessNums = 0;
        $("#hd_uploadify_logo").uploadify(hd_uploadify_options);
        });
</script>
<input type="file" name="up" id="hd_uploadify_logo"/><div class="hd_uploadify_logo_msg num_upload_msg"><span></span>单文件最大<strong>1MB，允许上传类型*.gif;*.jpg;*.png;*.jpeg</strong></div><div id="hd_uploadify_logo_queue"></div>
        <div class="hd_uploadify_logo_files uploadify_upload_files" input_file_id ="hd_uploadify_logo">
            <ul><?php
            $_uploadStr="";//编译文件需要的PHP字符串表示
            $upFileId=0;//第几张图片
            if(!empty($this->vars["logo"])){
            //读取图片数据
            foreach ($this->vars["logo"] as $f) {
                $upFileId++;
                $url = 'http://localhost/shopFrame/' . $f["path"];
        $_uploadStr.="<li><div class='delUploadFile'></div>";
        $_uploadStr.="<img src=" . $url . " path=" . $f["path"] . " width='98px' height='35px'/>";
        //显示图片alt
        if(isset($f["alt"])){
        $_uploadStr.="<div class='upload_title'>
<input type='text'  value='".$f["alt"]."' name='logo[".$upFileId."][alt]'>
</div>";
        }
        //显示原图
                $_uploadStr.="<input t='file' type='hidden' name='logo[".$upFileId."][path]' value='" . $f["path"] . "'/>";
                //缩略图
                if(isset($f["thumb"])){
                    foreach($f["thumb"] as $thumbFile){
                        $_uploadStr.="<input t='file' type='hidden' name='logo[".$upFileId."][thumb][]' value='" . $thumbFile. "'/>";
                    }
                }
                $_uploadStr.="</li>";
            }
            }
        echo $_uploadStr;
        ;
        ?></ul>
            <div style="clear:both;"></div>
        </div>
                                                                                <span style='color:#C81522;font-size:14px;font-family: Verdana,宋体,arial;'>*********logo建议尺寸98*35*********</span>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>是否热门</td>
                                                                        <td colspan="2">
                                                                                <input type="radio" name='is_hot' value='1' id="hot" <?php if($data['is_hot'] == 1){?>checked="checked"<?php }?>/>
                                                                                <label for="hot">是</label>
                                                                                <input type="radio" name='is_hot' value='0' id="nothot" <?php if($data['is_hot'] == 0){?>checked="checked"<?php }?>/>
                                                                                <label for="nothot">否</label>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>排序</td>
                                                                        <td colspan="2">
                                                                                <input type="text" name='sort' value="<?php echo $data['sort'];?>"/>
                                                                        </td>
                                                                </tr>
                                                                <tr>
                                                                        <td colspan='3' align='center'>
                                                                                <input type="hidden" name="bid" value="<?php echo $data['bid'];?>" />
                                                                                <input type="submit" class="btn btn-primary" value="修改品牌" />
                                                                        </td>
                                                                </tr>
                                                        </table>
                                                </fieldset>
                                        </form>

                                </div>
                        </div>
                </div>

                <script type="text/javascript">
                        $(function() {
                                $("#logo").uploadify({
                                        fileTypeDesc: '请选择LOGO图片',
                                        uploadLimit: 1,
                                        fileTypeExts: '*.gif; *.jpeg; *.jpg; *.png',
                                        buttonImage: '__UPLOADIFY__/btn.png',
                                        width: 120,
                                        height: 30,
                                        swf: '__UPLOADIFY__/uploadify.swf',
                                        uploader: '{:U("upload")}',
                                        //解决某些浏览器(主要是FF)Uploadify上传时丢失SESSION问题
                                        formData: {'<?php echo session_name();?>': '<?php echo session_id();?>'},
                                        onUploadSuccess: function(file, data, response) {
                                                eval('data=' + data);
                                                if (data.status == 1) {
                                                        var str = '<img src="__UPLOAD__/Logo/' + data.name + '" width="100" height="100" />';
                                                        str += '<input type="hidden" name="logo" value="' + data.name + '"/>';
                                                        $('#logo-wrap').empty().append(str).fadeIn(2000);
                                                } else {
                                                        alert(data.msg);
                                                }
                                        }
                                });
                        });
                </script>
        </body>
</html>